package jk.framework.spring.security.authorization;

import java.util.Set;

/**
 * 安全资源控制类
 * @author cuiochao
 */
public interface SecurityResource {

    String UNANIMOUS_STRATEGY = "unanimous";

    String CONSENSUS_STRATEGY = "consensus";

    String AFFIRMATIVE_STRATEGY = "affirmative";

    /**
     * 获取安全资源路径
     * @return
     */
    String getResource();
    /**
     * 获取资源所需的权限
     * @return
     */
    Set<String> getPermissions();
    /**
     * 获取安全策略
     * @return
     */
    default String getSecurityStrategy() {
        return AFFIRMATIVE_STRATEGY;
    }

    /**
     * 是否允许在选择unanimous多数投票相等时通过资源
     * @return
     */
    default boolean allowIfEqualGrantedDeniedDecisions(){
        return  false;
    }

}
